'use strict';

/** @type {import('sequelize-cli').Migration} */
module.exports = {
    async up(queryInterface, Sequelize) {
        await queryInterface.createTable('interest_tags', {
            id: {
                type: Sequelize.INTEGER.UNSIGNED,
                autoIncrement: true,
                primaryKey: true,
            },
            name: {
                type: Sequelize.STRING(128),
                allowNull: false,
                unique: true,
                comment: '兴趣标签名称'
            },
            createdAt: {
                type: Sequelize.DATE,
                allowNull: false,
            },
            updatedAt: {
                type: Sequelize.DATE,
                allowNull: false,
            }
        });

        // 添加一些初始兴趣标签
        await queryInterface.bulkInsert('interest_tags', [
            { name: '运动', createdAt: new Date(), updatedAt: new Date() },
            { name: '音乐', createdAt: new Date(), updatedAt: new Date() },
            { name: '美食', createdAt: new Date(), updatedAt: new Date() },
            { name: '旅行', createdAt: new Date(), updatedAt: new Date() },
            { name: '电影', createdAt: new Date(), updatedAt: new Date() },
            { name: '读书', createdAt: new Date(), updatedAt: new Date() },
            { name: '摄影', createdAt: new Date(), updatedAt: new Date() },
            { name: '游戏', createdAt: new Date(), updatedAt: new Date() },
            { name: '艺术', createdAt: new Date(), updatedAt: new Date() },
            { name: '科技', createdAt: new Date(), updatedAt: new Date() },
        ], { ignoreDuplicates: true });
    },

    async down(queryInterface, Sequelize) {
        await queryInterface.dropTable('interest_tags');
    }
}; 